<template>
  <submenu :name="parent.path">
    <template slot="title">
      <Icon :type="parent.icon" />
      {{ parent.name }}
    </template>
    <template v-for="(item, index) in parent.children">
      <re-submenu
        v-if="item.children"
        :parent="item" :key="`menu_${item.path}`">
      </re-submenu>
      <menu-item v-else :key="`menu_${item.path}`" :name="item.path">
        <Icon :type="item.icon" />
        {{ item.name}}
      </menu-item>
    </template>
  </submenu>
</template>

<script>
export default {
  name: 'ReSubmenu',
  props: {
    parent: {
      type: Object,
      default: () => ({})
    }
  }
}
</script>
